package com.globefrog.framework.log;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.pattern.PatternLayoutEncoderBase;

/**
 * 过滤信息输出格式解码.
 *
 * @author caijinbang
 * @date 2020-11-08 16:17
 */
public class FilterMessagePatternLayoutEncoder extends PatternLayoutEncoderBase<ILoggingEvent> {

  public FilterMessagePatternLayoutEncoder() {
  }

  @Override
  public void start() {
    // 设置自定义布局的上下文和输出格式
    FilterMessagePatternLayout patternLayout = new FilterMessagePatternLayout();
    patternLayout.setContext(this.context);
    patternLayout.setPattern(this.getPattern());
    patternLayout.start();
    this.layout = patternLayout;
    super.start();
  }
}
